<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zxx">

<head>
    <title>Home</title>
    <link rel="stylesheet" href="css/re.css" type="text/css" media="all" />
    <script src="js/jquery.min.js"></script>
    <!--//Style-CSS -->


</head>

<body>
    <div class="container">
        <div class="form-box">
            <!-- 注册 -->
            <form action="useradd.do" method="post">
                <div class="register-box hidden">
                    <h1>register</h1>
                    <input type="text" placeholder="用户名" required="required" name="username">
                    <input type="password" placeholder="密码" required="required" name="password">
                    <input type="text" placeholder="收货人" required="required" name="realname">
                    <input type="number" placeholder="收获手机号" required="required" name="phone">
                    <input type="text" placeholder="收获地址" required="required" name="address">
                    <button>注册</button>
                </div>
            </form>
            <!-- 登录 -->
            <form action="userauth.do" method="post">
                <div class="login-box">
                    <h1>login</h1>
                    <input type="text" placeholder="用户名" required="required" id="pwd" name="username">
                    <input type="password" placeholder="密码" required="required" id="pwds" name="password">
                    <button>登录</button>
                </div>
            </form>
        </div>
        <div class="con-box left">
            <h2>欢迎来到<span>萌宠之家</span></h2>
            <p>快来领取你的专属<span>宠物</span>吧</p>
            <img src="img/zuo.jpg" alt="">
            <p>已有账号</p>
            <button id="login">去登录</button>
        </div>
        <div class="con-box right">
            <h2>欢迎来到<span>萌宠之家</span></h2>
            <p>快来看看你的可爱<span>宠物</span>吧</p>
            <img src="img/you.jpg" alt="">
            <p>没有账号？</p>
            <button id="register">去注册</button>
        </div>
    </div>
    <script>
        window.addEventListener('load', function () {
            // 要操作到的元素
            var login = document.getElementById('login');
            var register = document.getElementById('register');
            var form_box = document.getElementsByClassName('form-box')[0];
            var register_box = document.getElementsByClassName('register-box')[0];
            var login_box = document.getElementsByClassName('login-box')[0];

            // 去注册按钮点击事件
            register.addEventListener('click', () => {
                form_box.style.transform = 'translateX(80%)';
                login_box.classList.add('hidden');
                register_box.classList.remove('hidden');

            })

            // 去登录按钮点击事件
            login.addEventListener('click', () => {
                form_box.style.transform = 'translateX(0%)';
                register_box.classList.add('hidden');
                login_box.classList.remove('hidden');
            })

        })
    </script>



</body>

</html>